//
//  ChechBoxView.m
//  TransportCar
//
//  Created by 张吉旭 on 2017/11/6.
//  Copyright © 2017年 amplity. All rights reserved.
//

#import "ChechBoxView.h"
@interface ChechBoxView()

@property (nonatomic,strong) NSString * titleStr;

@end

@implementation ChechBoxView

+ (ChechBoxView *)showViewWithTitle:(id)titleStr
                                 superView:(UIView *)superView{
    
    ChechBoxView *view = [super addSubviewsViewWithSuperView:superView];
    view.backgroundColor = HEXCOLOR(kColorGray7, 1);
    view.titleStr = titleStr;
    [view makeUI];
    return view;
}

- (void)makeUI{
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(0, 0, 40, 40);
    btn.enabled = YES;
    [btn setImage:[UIImage imageNamed:@"单选框"] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:@"单选框选中"] forState:UIControlStateSelected];
    [btn addTarget:self action:@selector(checkBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btn];
    
    UILabel * lab = [[UILabel alloc] initWithFrame:CGRectMake(btn.yj_right, btn.yj_y, 100, 40)];
    lab.text = _titleStr;
    [self addSubview:lab];
    
}



-(void)checkBtnClick:(UIButton *)sender
{
    _currentBtnSelected = sender.selected;
    sender.selected = !sender.selected;
}

@end
